<?php

require_once("main.php");

//print_r($_SESSION);
//exit;

require_once(DIR_LIB."VsGui".DIR_SEP."vspager.php");


// Form Processing
//===============================================================================================



// Init Model
//===============================================================================================
//$listOrders = ScbOrder::makeOrders();


// Init VIEW
//===============================================================================================
require_once("templates/scbpage.php");

$page = ScbPage::Instance();

require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_wrapper.php");
require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_menu.php");

require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_models.php");
require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operations.php");

$menu = new XCartVerticalMenu();

if(isset($_REQUEST['modid'])) {
	if(isset($_REQUEST['mode']) && ($_REQUEST['mode']=='work_count')) {
		require_once(dirname(__FILE__).DIR_SEP."templates".DIR_SEP."XCart".DIR_SEP."xcart_operations_work_count.php");

		$page->setTitle("Изработени Бройки по Операции");
		$formModels = new XCartOperationsWorkCount($page, $_REQUEST['modid']);

		$wrapper = new XCartWrapper($page);
		$wrapper->addMenu($menu->show());
		$wrapper->addCentralWdget($formModels->show());
	}
	else {
		$page->setTitle("Операции");
		$formModels = new XCartOperations($page, $_REQUEST['modid']);

		$wrapper = new XCartWrapper($page);
		$wrapper->addMenu($menu->show());
		$wrapper->addCentralWdget($formModels->show());
	}
}
else {
	$page->setTitle("Модели");
	
	$formModels = new XCartModels($page);

	$wrapper = new XCartWrapper($page);
	$wrapper->addMenu($menu->show());
	$wrapper->addCentralWdget($formModels->show());
}

$page->addWidget($wrapper);

$page->show();


// EXIT
//================================================================================================


?>
